package com.ecr.hub.front.bean.listener;

import java.util.Hashtable;
import java.util.Map;

import javax.servlet.http.HttpSession;
import javax.servlet.http.HttpSessionEvent;
import javax.servlet.http.HttpSessionListener;

public class SessionListener implements HttpSessionListener {

	public static Map<String, HttpSession> sessionMap;

	public SessionListener() {
		sessionMap = new Hashtable<String, HttpSession>();
	}

	@Override
	public void sessionCreated(HttpSessionEvent se) {
		HttpSession sess = se.getSession();
		String id = sess.getId();
		// ServletContext ctx = sess.getServletContext();
		sessionMap.put(id, sess);
	}

	@Override
	public void sessionDestroyed(HttpSessionEvent se) {

		HttpSession sess = se.getSession();
		String id = sess.getId();
		sessionMap.remove(id);
	}
}
